package k2_oop.p6_relation.demo09;

/**
 * 参照SalariedEmployee类定义HourlyEmployee类，实现按小时计算工资的员工处理。该类包括：
 * 	private成员变量wage和hour；
 * 	实现父类的抽象方法earnings(),该方法返回wage*hour值
 * 	toString()方法输出员工类型信息及员工的name，number,birthday
 */
public class HourlyEmployee extends Employee {

    private double wage;
    private int hour;

    public HourlyEmployee(String name, String number, MyDate birthday, double wage, int hour) {
        super(name, number, birthday);
        this.wage = wage;
        this.hour = hour;
    }

    @Override
    public double earnings(int month) {
        if(month==this.getBirthday().getMonth()){
            return this.wage*this.hour+100;
        }
        return this.wage*this.hour;
    }

    @Override
    public void display() {
        System.out.println("小时工");
        super.display();
    }
}
